public class test {
    public static void main(String[] args) throws OutOfMemoryError {
        try {
            int[] a = new int[Integer.MAX_VALUE];
        } catch (OutOfMemoryError e) {
            System.out.println(e.getMessage());
            System.out.println("Caught the OutOfMemoryError!");
        }
    }
}
